<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <input id="txt1" type="text" />
  <input id="btn1" type="button" value="按钮" />



  <script>
    let txt1 = document.getElementById("txt1")
    let btn1 = document.getElementById("btn1")

    btn1.onclick = function () {
      //txt1.value = "aaa"
      //txt1["value"] = "aaa"
      txt1.setAttribute("value","aaa")
    }
  </script>
</body>

</html>